<?xml version="1.0" encoding="utf-8" ?> 
<Feature id="ParallelIterator" name="Parallel BizObj iterator">
	<Description>
		<summary>Provides a mechanism for iterating through a collection of bizobjs in order to do processing
		on each of them.</summary>
		<remarks>
			<p>The parallel iterator is a set of business rules that work with application specific DARs and
			business rules to perform processing for each business object provided by the application. When a business
			rule is being used within the parallel process, the rule is included in the parallel execution context
			that was passed to the parallel iterator when it was started.  This allows information to be shared accross
			all the rules that are enlisted in the parallel execution process.</p>
			<p>When a DAR is used as an option, any parameters it needs to take need to use the "name address" type name
			because it is given the context as its map for parameters.</p>
			<p>When the number of bizobjs is greater then the grouping size, the bizobjs are broken down into groups of 
			parallel processing.</p>
		</remarks>
	</Description>
	
	<Dependencies>
		<Dependency type="binary">Swaf.ParallelIterator.dll</Dependency>
		<import>BaseFrameworkFeature.xml</import>
	</Dependencies>

	<BusinessRules visibility="public">
		<BusinessRule name="parallelIterate">
			<LocalClass name="Swaf.ParallelIterator.BizRules,SwafCore.ParallelIterator" />
		</BusinessRule>
	</BusinessRules>
	
	<BusinessRules visibility="private">
		<BusinessRule name="parallelIterate_processGroup">
			<LocalClass name="Swaf.ParallelIterator.BizRules,SwafCore.ParallelIterator" />
		</BusinessRule>
		<BusinessRule name="parallelIterate_processAll">
			<LocalClass name="Swaf.ParallelIterator.BizRules,SwafCore.ParallelIterator" />
		</BusinessRule>
	</BusinessRules>
	
	<BusinessObjects>
		<BusinessObject type="ParallelElement">
			<Description><summary>Defines an element needed for parallel iteration and can specify either a DAR
			or a bizrule name.  If a given element is a bizrule, it should set isBizRule to true, otherwise
			it is assumed the name is a DAR out of app.appData.</summary>
			<remarks>These are used in the ParallelIterator bizobj to indicate what elements of the application to execution
			when doing the pieces needed for parallel iteration.  As various things are needed, such as the count on the number
			of bizobjs to be iterated, the application can specify either a DAR or a bizrule be used to provide the count.
			</remarks></Description>
			
			<Field name="isBizRule" type="Boolean">false</Field>
			<Field name="name" type="String"/>
		</BusinessObject>
		
		<BusinessObject type="ParallelIterator">
			<Description>
				<summary>Defines how the parallel iterator should process the business objects.</summary>
				<remarks>
			
				</remarks>
			</Description>
			<Field name="groupSize" type="Integer" />
			<Field name="getBizObjCount" type="ParallelElement" />
			<Field name="getBizObjIds" type="ParallelElement" />
			
			<!-- Either specify getAllBizObjs or getBizObjGroup and optionally getLastBizObjGroup -->
			<!-- getAllBizObjs is used when getBizObjCount returns a value that is smaller then groupSize -->
			<Field name="getAllBizObjs" type="ParallelElement"/>
			<Field name="getBizObjGroup" type="ParallelElement" />
			<!-- This field is optional.  If not specified, the 'getBizObjGroup' element is used for the last group of the list. -->
			<Field name="getLastBizObjGroup" type="ParallelElement"/>
			
			<!-- This field specifies the DAR or rule to call for each bizobj in the list. -->
			<Field name="processBizObj" type="ParallelElement" />
		</BusinessObject>

		<BusinessObject type="ParallelIteratorGroup">
			<Description><summary>Defines the low and high key of a parallel iteration group.  This is passed to the dar or bizrules
			specified in the getBizObjGroup and getLastBizObjGroup elements of ParallelIterator.</summary></Description>
			<Field name="lowKey" />
			<Field name="highKey" />
			<Field name="baseInfo" type="ParallelIterator" />
			<!-- This field is a work field that can be used by the getBizObjGroup ParallelElements to store their
			     BizObjList while they populate it.  This can be useful when using the Merge mechanism of the DAR bizobj formatter -->
			<Field name="groupList" type="Object" />
		</BusinessObject>	
	</BusinessObjects>

</Feature>